<html>
<head>
<title>Mform - Example 1</title>
<script type="text/javascript" src="www/js/Mcalendar.js"></script>
<script type="text/javascript" src="www/js/Mvalidation.js"></script>
</head>
<body>


<h1>Mform</h1>

<?php 
function __autoload($class) {
	$dirs = array('classes', 'interfaces', 'elements');
	$file_p = '%s/%s.class.php';
	foreach($dirs as $d) {
		$s_temp = sprintf($file_p, $d, $class);
		if(is_readable($s_temp)) {
			require_once $s_temp;
			return true;
		}
	}
}

try {

	$O = new Mform('GET');
	$O->addElement('text', 'plouf', 'Label1', 'default1');
	$O->addElement('textarea', 'plaf', 'plaf');
	$O->addElement('date-text', 'date1', 'Label2');

	$O->addElement('date-text', 'date2', 'Label2-1');
	//echo MdateText::writeHeader('www/js/yui/');

	$O->addElement('submit', 'Valider', 'GO', 'go');

	$O->addRule('plaf', 'Plaf is required', 'required');



	if($O->validate()) {
		echo 'Validation success. <a href="index.php">Back</a>';
	} else {
		echo $O->display();
	}
} catch(Exception $e) {
	echo $e->getMessage();
}

?>


</body>
</html>